package simtester.server

import groovy.time.TimeCategory

class Iteration {

    Long testcase
    Integer user
    Integer num
    String status
    Date startDate
    Date endDate
    
    static constraints = {
        testcase nullable: true
        endDate nullable: true
    }
    
    static mapping = {
        startDate index: true
        endDate index: true
        testcase index: true
    }
    
    
    def duration() {
        if (!endDate) {
            return -1
        } else {
            use(TimeCategory) {
                return (endDate - startDate)
            }
        }
    }
}
